package cn.com.scooper.pojo.po;

import cn.com.scooper.pojo.vo.IotDeviceIndexVo;
import com.alibaba.fastjson.JSON;
import lombok.Data;

import java.io.Serializable;
import java.util.UUID;

/**
 * @author Administrator
 *
 * 物联边坡设备
 */
@Data
public class MineIotIndexPo implements Serializable {
    /**
     * 露天矿山物联感知设备-监测指标
     */
    private Integer id;

    /**
     * 是否有效(1:有效；0:无效)
     */
    private Integer actived;

    /**
     * 监测参数单位
     */
    private String monitoringUnit;

    /**
     * 一级预警阈值
     */
    private Double oneLevelAlarm;

    /**
     * 二级预警阈值
     */
    private Double twoLevelAlarm;

    /**
     * 三级预警阈值
     */
    private Double threeLevelAlarm;

    /**
     * 源指标ID
     */
    private String sourceIndexId;

    /**
     * 子设备类型
     */
    private String subEquipType;

    /**
     * 设备id
     */
    private String deviceSourceId;

    /**
     * T_MINE_IOT_SLOPE_INDEX
     */
    private static final long serialVersionUID = 1L;

    public MineIotIndexPo(IotDeviceIndexVo iotDeviceIndexVo, String subEquipType, String deviceId, String monitoringUnit) {
        this.actived = 1;
        if (monitoringUnit != null){
            this.monitoringUnit = monitoringUnit;
        }
        this.deviceSourceId = deviceId;
        this.oneLevelAlarm = iotDeviceIndexVo.getBlue();
        this.twoLevelAlarm = iotDeviceIndexVo.getYellow();
        this.threeLevelAlarm = iotDeviceIndexVo.getRed();
        this.subEquipType = subEquipType;
        this.sourceIndexId = UUID.randomUUID().toString().substring(0,32);
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }
}